﻿@model handvn.Models.Product
@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}
@if (Request.IsAuthenticated && @Session["LoaiTaiKhoan"]!=null)
{
    if (@Session["LoaiTaiKhoan"].ToString() == "admin" || @Session["LoaiTaiKhoan"].ToString() == "mod")
    {
    <h1>
        Quản lý sản phẩm</h1>
    <h2>
        Edit</h2>

    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

    using (Html.BeginForm())
    {
        @Html.ValidationSummary(true)
    <fieldset>
        <legend>Product</legend>
        @Html.HiddenFor(model => model.ProductID)
        <div class="editor-label">
            @Html.LabelFor(model => model.TenSanPham)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.TenSanPham)
            @Html.ValidationMessageFor(model => model.TenSanPham)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.GiaSanPham)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.GiaSanPham)
            @Html.ValidationMessageFor(model => model.GiaSanPham)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.GiaThiTruong)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.GiaThiTruong)
            @Html.ValidationMessageFor(model => model.GiaThiTruong)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.HinhAnh)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.HinhAnh)
            @Html.ValidationMessageFor(model => model.HinhAnh)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.GioiThieu)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.GioiThieu)
            @Html.ValidationMessageFor(model => model.GioiThieu)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.SoLuong)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.SoLuong)
            @Html.ValidationMessageFor(model => model.SoLuong)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.SoLuotXem)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.SoLuotXem)
            @Html.ValidationMessageFor(model => model.SoLuotXem)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.NgayNhapSanPham)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.NgayNhapSanPham)
            @Html.ValidationMessageFor(model => model.NgayNhapSanPham)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.DetailCategoriesID, "DetailCategories")
        </div>
        <div class="editor-field">
            @Html.DropDownList("DetailCategoriesID", String.Empty)
            @Html.ValidationMessageFor(model => model.DetailCategoriesID)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.UserID, "User")
        </div>
        <div class="editor-field">
            @Html.DropDownList("UserID", String.Empty)
            @Html.ValidationMessageFor(model => model.UserID)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.TinhTrang)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.TinhTrang)
            @Html.ValidationMessageFor(model => model.TinhTrang)
        </div>
        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
    }

    <div>
        @Html.ActionLink("Back to List", "Index")
    </div>
    }
}
else
{
    <p>
        Xin vui lòng đăng nhập</p>
    <script type="text/javascript">
        window.location.href = "http://handvn.com/Account/Admin"
    </script>
}